<template>
    <v-box :title="'密钥更新策略'">
       <VCenter style="padding-top:15px; padding-left:15px; max-width:500px;">
            <template #head>
                <VCenter :row="true">
                    <template #head>
                          更新策略为: 每  
                          <n-input-number 
                          :show-button="false" 
                          placeholder="天数" 
                          style="width:70px; margin:0 15px"
                          v-model:value="userInfo.KEYTACTICS" />
                          天更新一次
                    </template>                   
                </VCenter>
                <view style="height:30px;"></view>

                <VCenter :row="true" style="padding-left:70px;">
                    <template #head>
                        <n-button @click="updateCname(userInfo.KEYTACTICS)" color="#2f9383">
                            确认修改
                        </n-button >
                    </template>
                </VCenter>
            </template>
        </VCenter>
    </v-box>
</template>
<script>
import VBox from "@/components/scraw/VBox.vue"
import VCenter from "@/components/scraw/VCenter.vue"
import { getCurrentInstance, ref } from "vue"
export default {
    components:{VBox, VCenter},
    methods:{
        updateType() {
            
        }
    },
    data(){return {days:null}},
    setup() {
        const { proxy: cthis }  = getCurrentInstance()
        return { userInfo:ref(cthis.$userInfo), updateCname: function(keyDays) {
                if(keyDays) {
                    cthis.$http.get('updateKeyDays', { params:{ keyDays }}).then(()=> {
                      this.userInfo.KEYTACTICS = keyDays
                    })
                }else {
                    cthis.$ElMessage({message:"请输入",type:'warning',center:true})
                }
                 
            }
        }
    },
}
</script>